var inferredString = 'this is a string';
var inferredNumber = 1;

// inferredNumber = inferredString //Type 'string' is not assignable to type 'number'.

// Duck typing
var nameIdObject = {
    name: 'myName',
    id: 1,
    print() {}
};
nameIdObject = {
    id: 2,
    name: 'anotherName',
    print() {}
}
/*
nameIdObject = {
    id: 3,
    name: 'thirdName'
}
*/
// TS2741: Property 'print' is missing in type '{ id: number; name: string; }'
// but required in type '{ name: string; id: number; print(): void; }'.

var obj1 = {id:1, print(){}};
var obj2 = {id: 2, print(){},select(){}}

obj1 = obj2;
// obj2 = obj1;

/*
* TS2741: Property 'select' is missing in type '{ id: number; print(): void; }'
* but required in type '{ id: number; print(): void; select(): void; }'.
* */
/*
* Tips: ====> duck typing examples used here also using inferred typing,
* so the type of an object is inferred from when it is first assigned.
* */
